package com.wclass.mapper;

import com.baomidou.mybatisplus.mapper.Wrapper;
import com.wclass.entity.BaseDiscount;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 优惠券管理 Mapper 接口
 * </p>
 *
 * @author SEN
 * @since 2019-02-25
 */
public interface BaseDiscountMapper extends BaseMapper<BaseDiscount> {

    /**
     * 根据课程id分组查询数量
     * @param wrapper
     * @return
     */
    @Select("select count(1) " +
            "from base_discount " +
            "where 1 = 1 " +
            "${ew.sqlSegment}")
    List<Integer> selectCountByCourseId(@Param("ew") Wrapper<BaseDiscount> wrapper);

}
